package com.jubao.modules.sys.controller;

import com.jubao.common.annotation.SysLog;
import com.jubao.common.entity.Page;
import com.jubao.common.entity.R;
import com.jubao.modules.sys.entity.BankEntity;
import com.jubao.modules.sys.service.BankService;
import com.jubao.modules.sys.vo.BankVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 资产信息
 *
 * @author jubaodai<3 6 3 2 1 7 2 3 7 @ qq.com>
 */
@RestController
@RequestMapping("/sys/bank")
public class BankController extends AbstractController {

    @Autowired
    private BankService bankService;

    /**
     * 列表
     *
     * @param params
     * @return
     */
    @RequestMapping("/list")
    public Page<BankEntity> list(@RequestBody Map<String, Object> params) {
        return bankService.listBank(params);
    }

    /**
     * 资产变更列表
     *
     * @param params
     * @return
     */
    @RequestMapping("/change")
    public Page<BankVo> change(@RequestBody Map<String, Object> params) {
        return bankService.listChangeBank(params);
    }

    /**
     * 新增
     *
     * @param bank
     * @return
     */
    @SysLog("新增资产信息")
    @RequestMapping("/save")
    public R save(@RequestBody BankEntity bank) {
        return bankService.saveBank(bank);
    }

    /**
     * 根据id查询详情
     *
     * @param id
     * @return
     */
    @RequestMapping("/info")
    public R getById(@RequestBody Long id) {
        return bankService.getBankById(id);
    }

    /**
     * 修改
     *
     * @param bank
     * @return
     */
    @SysLog("修改资产信息")
    @RequestMapping("/update")
    public R update(@RequestBody BankEntity bank) {
        return bankService.updateBank(bank);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @SysLog("删除资产信息")
    @RequestMapping("/remove")
    public R batchRemove(@RequestBody Long[] id) {
        return bankService.batchRemove(id);
    }

}
